export default {
  data() {
    return {
      formValidationRules: {
        required: {
          required: true,
          message: '此项为必填项'
        },
        email: {
          type: 'email',
          message: '请输入有效的邮箱地址'
        },
        phone: {
          pattern: /^1[3-9]\d{9}$/,
          message: '请输入有效的手机号码'
        }
      }
    }
  },
  methods: {
    validateForm(form) {
      return new Promise((resolve, reject) => {
        form.validate(valid => {
          if (valid) {
            resolve(true)
          } else {
            this.$message.error('请检查表单填写是否正确')
            reject(false)
          }
        })
      })
    },
    resetForm(form) {
      form.resetFields()
    }
  }
} 